<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>require</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.return.html">« return</a></li>
      <li style="float: right;"><a href="function.include.html">include »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="language.control-structures.html">流程控制</a></li>
    <li>require</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.require" class="sect1">
 <h2 class="title">require</h2>
 <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p>

 <p class="para">
  <code class="literal">require</code> 和 <span class="function"><a href="function.include.html" class="function">include</a></span>
  几乎完全一样，除了处理失败的方式不同之外。<span class="function"><strong>require</strong></span>
  在出错时产生 <strong><code>E_COMPILE_ERROR</code></strong>
  级别的错误。换句话说将导致脚本中止而 <span class="function"><a href="function.include.html" class="function">include</a></span>
  只产生警告（<strong><code>E_WARNING</code></strong>），脚本会继续运行。
 </p>
 <p class="para">
  参见 <span class="function"><a href="function.include.html" class="function">include</a></span> 文档了解详情。
 </p>
</div></div></div></body></html>